Oil Spills in California

An interactive map and chloreopath of oil spills in California in 2008.

Anna Talken
02-22-2021

Summary

In this report, I am analyzing the documented oil spills that occurred in California in 2008. I created an interactive map that illustrates each individual oil spill in every county throughout the state. A chloreopath shows the density of the number of oil spills in each county, which highlights Los Angeles County as having the greatest number of oil spills in 2008. Data for CA oil spills is from CAOpenData, Department of Fish and Wildlife.

hide
#read in the data
ca_counties <- read_sf(here("_posts", "2021-02-22-interactive_map", "ca_counties", "CA_Counties_TIGER2016.shp"))

# Wrangling

ca_subset <- ca_counties %>% 
  select(NAME, ALAND) %>% #keeping only county name and land area, but since it is a simple feature object, it keeps the spatial information (column geometry)
  rename(county_name = NAME, land_area = ALAND)


# Add the oil spill data

oil_spill <-read_sf(here("_posts", "2021-02-22-interactive_map", "Oil_Spill_Incident_Tracking_%5Bds394%5D-shp", "Oil_Spill_Incident_Tracking_%5Bds394%5D.shp"))

Interactive Map of Oil Spills in CA in 2008

hide
tmap_mode(mode = "view") 
  
tm_shape(ca_subset) +
  tm_fill("land_area", palette = "BuGn") +
  tm_shape(oil_spill) +
  tm_dots(col = "black")

Chloreopath of Oil Spills In CA in 2008

hide
# finding number of oil spills per county

ca_oil_spills <- ca_subset %>% 
  st_join(oil_spill)

oil_counts <- ca_oil_spills %>% 
  count(county_name)

ggplot(data = oil_counts) +
  geom_sf(aes(fill = n), color = "black", size = 0.2) +
  scale_fill_gradientn(colors = c("lightgray", "yellow", "red")) +
  theme_minimal() +
  labs(title = "Number of oil spills across counties in California in 2008",
       fill = "Number of oil spills")